package com.briup.jd2511.web03.controller;

import com.briup.jd2511.web03.service.EmpService;
import com.briup.jd2511.web03.service.impl.EmpImpl;
import com.briup.jd2511.web03.util.Result;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emp")
public class EmpController {

    // 根据bean的类型注入
//    @Qualifier("empJdbcImpl")
//    @Autowired

    // 根据bean的名字注入
    @Resource(name="empJdbcImpl")
    EmpService empService;

    @GetMapping
    public Result getAll(){
        // 调用service层的代码
        return Result.ok(empService.getAll());
    }
}
